//package com.gen.info.generate_cluster_information.service;
//
//import com.alibaba.excel.EasyExcel;
//import com.gen.info.generate_cluster_information.Listener.ReadOceanBaseListener;
//import com.gen.info.generate_cluster_information.mode.OceanBaseClusterInfo;
//import com.gen.info.generate_cluster_information.mode.OceanBaseClusterInfoDO;
//import com.gen.info.generate_cluster_information.mode.RSPoolVO;
//import com.gen.info.generate_cluster_information.mode.RSUnitVO;
//import com.gen.info.generate_cluster_information.util.GetExcelUrlUtil;
//import jdk.internal.org.objectweb.asm.tree.analysis.Value;
//import org.springframework.boot.ApplicationArguments;
//import org.springframework.boot.ApplicationRunner;
//import org.springframework.stereotype.Component;
//
//import java.util.Collection;
//import java.util.HashMap;
//@Component
//public class MainTask implements ApplicationRunner {
//    public static void CreateClusterRS(){
//        /*
//        * 启动easyExcel
//        * */
//        //SpringApplication.run(GenerateClusterInformationApplication.class, args);
//        final GetExcelUrlUtil getExcelUrlUtil = new GetExcelUrlUtil();
//        String fileName  =getExcelUrlUtil.getExcelUrl("easyExcel.xlsx");
//        // 实例化读取参
//        // 直接读取数据，不指定表头行号，默认从第一行开始读取数据
//        EasyExcel.read(fileName, OceanBaseClusterInfo.class, new ReadOceanBaseListener()).sheet().doRead();
//        //获取集群信息资源
//        final Collection<OceanBaseClusterInfoDO> clusterInfoDOS = ReadOceanBaseListener.clusterInfos.values();
//        /*创建资源单元
//        * */
//        final HashMap<String, RSUnitVO> unitRS = CreateUnit.getUnitRS(clusterInfoDOS);
//        CreateUnit.CreateUnitRS(unitRS);
//        /*创建资源池
//        * */
//        final HashMap<String, RSPoolVO> rsPool = CreateResourcePool.getRSPool(clusterInfoDOS, unitRS);
//        CreateResourcePool.CreateResourcePool(rsPool);
//        /*
//        * 创建租户
//        * */
//        CreateTenant.CreateTenantRS(CreateTenant.getTenantRS(clusterInfoDOS,rsPool));
//        /*
//        * 创建数据库和用户
//        * */
//        CreateDatabaseUser.CreateDBRS(clusterInfoDOS);
//        /*给用户授予对应数据库的权限*/
//        GrantUserAuthority.grantAuthority(clusterInfoDOS);
//    }
//    /*初始化程序*/
//    @Override
//    public void run(ApplicationArguments args) throws Exception {
//        CreateClusterRS();
//    }
//}
